#include "modifyusermessage.h"
#include "ui_modifyusermessage.h"
#include <QMessageBox>
modifyUserMessage::modifyUserMessage(QString userID,QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::modifyUserMessage)
{
    ui->setupUi(this);
    db = new dataBase();
    this->userID = userID;
    ui->userID->setText("用户ID: " + userID);
    QString userMessage = db->query_userMessage(userID);
    QStringList userdata = userMessage.split(",",Qt::SkipEmptyParts);

    QString userName = userdata[1];
    QString phoneNumber = userdata[2];
    ui->userName->setText(userName);
    ui->phoneNumber->setText(phoneNumber);
}

modifyUserMessage::~modifyUserMessage()
{
    delete db;
    delete ui;
}


void modifyUserMessage::on_pushButton_clicked()
{
    QString userName = ui->userName->text();
    QString phoneNumber = ui->phoneNumber->text();
    QString new_passwd = ui->new_passwd->text();
    db->modify_userMessage(userID,userName,phoneNumber,new_passwd);

    QMessageBox::information(this,"提示","修改用户信息成功");
}


void modifyUserMessage::on_pushButton_2_clicked()
{
    this->close();
}

